package com.qianfeng.openapi.managerplateform.controlller;

import com.qianfeng.openapi.managerplateform.pojo.ResponseData;
import com.qianfeng.openapi.managerplateform.pojo.UserToken;
import com.qianfeng.openapi.managerplateform.service.UserTokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sys/token")
public class UserTokenController {
    //
    @Autowired
    private UserTokenService userTokenService;
    ResponseData responseData = new ResponseData();
    @RequestMapping("/table")
    public ResponseData getAllUserToken(int page,int limit){
        return userTokenService.getAllUserToken(page, limit);

    }


    //del
    @RequestMapping("/del")
    public ResponseData delUserToken(int[] ids){
        boolean b = userTokenService.delUserToken(ids);
        if(b){
            responseData.setCode(1);
            responseData.setMsg("true");

            return responseData;
        }
        responseData.setCode(0);
        responseData.setMsg("false----s删除成功");
        return responseData;
    }

    @RequestMapping("/update")
    public ResponseData updateUserToken(UserToken userToken){
        boolean b = userTokenService.updateUserToken(userToken);
        if(b){
            responseData.setCode(1);
            responseData.setMsg("true");
            responseData.setData(b);
            return responseData;
        }
        responseData.setCode(0);
        responseData.setMsg("false----修改成功");
        return responseData;
    }
}
